import { ComponentType, ElementType } from "@/seed-application/types";
import { componentManager, elementManager, menuManager, SeedApplication } from "./SeedApplication";

export const seedApplication = new SeedApplication()
export const unitKey = Symbol('unit')

export function getVueApp() {
  return seedApplication.getVueApp()
}

export function getApp() {
  return seedApplication.getApp()
}

export function getMenus() {
  return menuManager.getMenus()
}

export function getActions() {
  return seedApplication.getActions()
}

export function getDataActions() {
  return seedApplication.getDataActions()
}

export function getFieldActions() {
  return seedApplication.getFieldActions()
}

export function permissionsToTree(permissions: string[]) {
  return seedApplication.permissionsToTree(permissions)
}

export function getAction(actionName: string, seedName?: string, microName?: string) {
  return seedApplication.getAction(actionName, seedName, microName)
}

export function getSeed(seedName: string, microName?: string) {
  return seedApplication.getSeed(seedName, microName)
}

export function getComponent(type: ComponentType, name?: string) {
  return componentManager.getComponent(type, name)
}

export function getElement(elementType: ElementType, type: 'read' | 'write' | 'set' = 'read', name?: string) {
  return elementManager.getElement(elementType, type, name)
}